include(ExternalProject)
include(cmake/util.cmake)

if (ENABLE_NNDEPLOY_PROTOBUF STREQUAL "OFF")
elseif (ENABLE_NNDEPLOY_PROTOBUF STREQUAL "ON")
  option(protobuf_BUILD_TESTS "" OFF)
  option(protobuf_MSVC_STATIC_RUNTIME "" ${ONNX_USE_MSVC_STATIC_RUNTIME})
  # option(Protobuf_USE_STATIC_LIBS "" OFF)

  # find_package(Protobuf REQUIRED)
  # if(Protobuf_FOUND)
  #   include_directories(${Protobuf_INCLUDE_DIRS})
  #   message(STATUS "Protobuf_LIBRARIES: ${Protobuf_LIBRARIES}")
  #   set(NNDEPLOY_THIRD_PARTY_LIBRARY ${NNDEPLOY_THIRD_PARTY_LIBRARY} ${Protobuf_LIBRARIES})
  # else()
  #   # 编译为动态库
  #   # set(protobuf_BUILD_SHARED_LIBS ON CACHE BOOL ... FORCE)
  #   set(LIBS libprotobuf)
  #   set(LIBS ${LIBS} libprotobuf-lite)
  #   add_subdirectory_if_no_target(${PROJECT_SOURCE_DIR}/third_party/protobuf ${LIBS})
  #   include_directories(${PROBUF_ROOT}/src)
  #   set(NNDEPLOY_THIRD_PARTY_LIBRARY ${NNDEPLOY_THIRD_PARTY_LIBRARY} ${LIBS})
  # endif()

  # 编译为动态库
  # set(protobuf_BUILD_SHARED_LIBS ON CACHE BOOL ... FORCE)
  message(STATUS "protobuf_BUILD_SHARED_LIBS")
  set(LIBS libprotobuf)
  set(LIBS ${LIBS} libprotobuf-lite)
  add_subdirectory_if_no_target(${PROJECT_SOURCE_DIR}/third_party/protobuf ${LIBS})
  # include_directories(${PROBUF_ROOT}/src)
  # set(NNDEPLOY_THIRD_PARTY_LIBRARY ${NNDEPLOY_THIRD_PARTY_LIBRARY} ${LIBS})
else()
endif()
